package numberFive;

public class Number {
    private int hundred=1;

    public int getHundred() {
        return hundred;
    }

    public void setHundred(int hundred) {
        this.hundred = hundred;
    }

    public synchronized void give(){
        Thread thread = Thread.currentThread();
        System.out.println(thread.getName()+"输出了"+this.hundred);
        if (this.hundred>=100){
            System.exit(0);
        }
        this.hundred=this.hundred+1;
        this.notifyAll();
        try {
            this.wait();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

    }
}
